<template>
    <div class="id">
        <div  class="van-nav-bar van-hairline--bottom">
            <div class="van-nav-bar__content"><div class="van-nav-bar__left">
                <i class="van-icon van-icon-arrow-left van-nav-bar__arrow"><!----></i>
                <span class="van-nav-bar__text">返回</span></div>
                <div class="van-nav-bar__title van-ellipsis">我的消息</div>
                <div class="van-nav-bar__right">
                    <!-- <span class="van-nav-bar__text">创建会话</span> -->
                    <span @click="drawer = true" type="primary" style="margin-left: 16px;" class="van-nav-bar__text">
  创建会话
</span>
                    </div></div></div>
                    <el-drawer

  title="我是标题"
  :visible.sync="drawer"
  size="65%"
  :with-header="false"
  :direction="direction">
<div  class="van-search van-search--show-action">
<div  class="van-search__content van-search__content--square">
<div  class="van-cell van-cell--borderless van-field" style=" padding: 5px  0px;">
<div class="van-field__left-icon"><i class="van-icon el-icon-search"></i></div>
<div class="van-cell__value van-cell__value--alone van-field__value"><div class="van-field__body"><input type="search" v-model="username" placeholder="请输入名字" class="van-field__control"></div></div>
</div>
</div>
<div  role="button" tabindex="0" class="van-search__action"><div @click="search">搜索</div></div>
</div>

<div ><div  class="bg-nav my-style">
    <div class="van-index-anchor" style="display:none">id</div></div>
    <div  role="button" tabindex="0" class="van-cell van-cell--clickable van-cell--center" style="height: 50px;" v-for="item in chartList">
        <div  class="van-cell__value1 van-cell__value--alone"><div  class="address_line"><img :src="item.picture"><div  class="width-100">
            <div  class="left-right"><span  class="address_line_name">{{item.name}}</span></div></div></div></div></div>

            <!-- <div  role="button" tabindex="0" class="van-cell van-cell--clickable van-cell--center" style="height: 50px;">
                <div  class="van-cell__value1 van-cell__value--alone"><div  class="address_line"><img ><div  class="width-100">
                    <div  class="left-right"><span  class="address_line_name">123</span></div></div></div></div></div>

                    <div  role="button" tabindex="0" class="van-cell van-cell--clickable van-cell--center" style="height: 50px;">
                        <div  class="van-cell__value1 van-cell__value--alone">
                            <div  class="address_line">
                                <img :src="img">
                                <div  class="width-100"><div  class="left-right">
                                    <span  class="address_line_name"></span></div></div></div></div></div> -->

                                    </div>
  <!-- <span>我来啦!</span> -->
</el-drawer>
                <div  class="padding-bottom-60 margin-top-10">
<div  role="button" v-for="item in msgList" tabindex="0" class="van-cell van-cell--clickable van-cell--center" @click="enter(item)">
<div class="van-cell__value van-cell__value--alone">
<div  class="vertical-center">
    <el-badge is-dot class="item">
<img class="img" :src="item.picture">
    </el-badge>
<div   class="width-100"><div   class="left-right">
    <span   class="contact-name">{{item.name}}</span>
    <span   class="chat-gery-l contact-date">{{item.updateTime}}</span></div>
    <!-- <el-badge :value="3" class="item3">
  <el-button size="small">回复</el-button>
</el-badge> -->
    <div   class="left-right"><span   class="chat-gery-l contact-message">{{item.contentLast}}</span></div></div>
</div>
</div>
</div>
                </div>
    </div>
</template>
<script >
 import axios from 'axios'
export default {
      data() {
    return {
        chartList:[],
        username:'',
        img:"0",
         direction: 'rtl',
        drawer: false,
msgList:[{},{},{}]
    }
},
created(){
this.findmessage();
},
methods:{
    search(){
        let url='http://localhost:8098/searchchart';
        let param={
            username:this.username
        }
        axios.post(url,param).then(resp=>{
            let result=resp.data
            if(result.code===200){
                this.chartList=result.data
            }
        })
    },
    enter(e){
        this.$router.push({path:'/chart',query:{user:e.id}})
    },
findmessage(){
    let url='http://localhost:8098/findMessage'
    let param={
        token:localStorage.getItem("token")
    }
axios.post(url,param).then(resp=>{
    let result=resp.data;
    if(result.code===200){
        this.msgList=result.data
    }else{
         this.$message({
            showClose: true,
          message: result.errorMessage,
          type: 'error'
        });
    }
})
},
}
}
</script>
<style scoped>
.van-cell::after {
    position: absolute;
    box-sizing: border-box;
    content: ' ';
    pointer-events: none;
    right: 16px;
    bottom: 0;
    left: 16px;
    border-bottom: 1px solid #ebedf0;
    -webkit-transform: scaleY(.5);
    transform: scaleY(.5);
}
.left-right {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.address_line_name {
    font-size: 16px;
    font-weight: inherit;
    margin-left: 16px;
}
.van-cell__value--alone {
    color: #323233;
    text-align: left;
}
img {
    width: 36px;
    height: 36px;
    border-radius: 3px;
}
.address_line {
    display: flex;
    align-items: center;
}
.van-cell__value1 {
        -webkit-box-flex: 1;
    flex: 1;
    position: relative;
    overflow: hidden;
    vertical-align: middle;
    word-wrap: break-word;
}
.van-cell__value--alone {
    color: #323233;
    text-align: left;
}
.van-cell--center {
    -webkit-box-align: center;
    align-items: center;
}
.van-cell--clickable {
    cursor: pointer;
}
.van-index-anchor {
    z-index: 1;
    box-sizing: border-box;
    padding: 0 16px;
    color: #323233;
    font-weight: 500;
    font-size: 14px;
    line-height: 32px;
    background-color: transparent;
}
.bg-nav {
    background: #EDEDED;
    margin-bottom: 6px;
}
.van-search__content--square{
     color:  #f7f8fa;
}
.van-search__action {
    padding: 0 8px;
    color: #323233;
    font-size: 14px;
    line-height: 34px;
    cursor: pointer;
    user-select: none;
}
input {
    writing-mode: horizontal-tb !important;
    text-rendering: auto;
    letter-spacing: normal;
    word-spacing: normal;
    text-transform: none;
    text-indent: 0px;
    text-shadow: none;
    -webkit-rtl-ordering: logical;
    cursor: text;

}
.van-field__control[type=search] {
        display: block;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    color: #323233;
    line-height: inherit;
    text-align: left;
    background-color: transparent;
    border: 0;
    resize: none;
    -webkit-appearance: none;
}
.van-field__body {
    display: flex;
    -webkit-box-align: center;
    align-items: center;
}
.van-cell__value {
    flex: 1;
    -webkit-box-flex: 1;
    position: relative;
    vertical-align: middle;
    word-wrap: break-word;
}
.van-cell__value--alone {
    color: #323233;
    text-align: left;
}
.van-field__value {
    overflow: visible;

}
.van-icon:before {
    display: inline-block;
}
.van-icon {
    display: block;
    font-size: 16px;
    line-height: inherit;
        text-rendering: auto;
    -webkit-font-smoothing: antialiased;
        font: normal normal normal 14px/1 vant-icon;
        position: relative;
}
.van-field__left-icon {
    margin-right: 4px;
}
.van-cell{
    flex: 1;
    padding: 5px  0px;
    background-color: transparent;
    -webkit-box-flex: 1;
    overflow: hidden;
    color: #323233;
    font-size: 14px;
    line-height: 24px;
    display: flex;
    box-sizing: border-box;
    width: 100%;
}
.van-search__content {
    flex: 1;

    padding-left: 0px;
    background-color: #f7f8fa;
    border-radius: 2px;
    display: flex;
    -webkit-box-flex: 1;
}
.van-search--show-action {
    padding-right: 0;
}
.van-search{
    align-items: center;
    box-sizing: border-box;
    padding: 10px 12px;
    background-color: #fff;

        display: flex;
    -webkit-box-align: center;
}
.item {
  margin-top: 5px;
  margin-right: 0px;
}
.contact-message  {
    font-size: 12px;
    margin-left: 16px;
}
.chat-gery-l {
    color: #AFABA7;
}
.contact-date  {
    font-size: 12px;
}
.contact-name  {
    font-size: 18px;
    /* font-family: sans-serif; */
    font-weight: inherit;
    margin-left: 16px;
}
.left-right {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.width-100 {
    width: 100%;
}
.img{
    width: 46px;
    height: 46px;
    border-radius: 3px;
}
.vertical-center {
    display: flex;
    align-items: center;
}
.van-cell__value {
    position: relative;
    overflow: hidden;
    flex: 1;
        -webkit-box-flex: 1;
    vertical-align: middle;
    word-wrap: break-word;
}
.van-cell__value--alone {
    color: #323233;
    text-align: left;
}
.van-cell {
    position: relative;
    display: flex;
    box-sizing: border-box;
    width: 100%;
    padding: 10px 16px;
    overflow: hidden;
    color: #323233;
    font-size: 14px;
    line-height: 24px;
    background-color: #fff;
}
.van-cell--clickable {
    cursor: pointer;
}
.van-cell--center {
    -webkit-box-align: center;
    align-items: center;
}
.padding-bottom-60 {
    padding-bottom: 60px;
}
.margin-top-10 {
    margin-top: 10px;
}
.id{
    font-family: -apple-system,BlinkMacSystemFont,'Helvetica Neue',Helvetica,Segoe UI,Arial,Roboto,'PingFang SC',miui,'Hiragino Sans GB','Microsoft Yahei',sans-serif;

    margin: -5px;
    padding: 0;
}
.van-hairline--bottom::after {
    border-bottom-width: 1px;
}

[class*=van-hairline]::after {
    position: absolute;
    box-sizing: border-box;
    content: ' ';
    pointer-events: none;
    top: -50%;
    right: -50%;
    bottom: -50%;
    left: -50%;
    border: 0 solid #ebedf0;
    transform: scale(.5);
}
.van-nav-bar__right {
    align-items: center;
    padding: 0 16px;
    font-size: 14px;
    cursor: pointer;
        display: flex;
    -webkit-box-align: center;
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
}
.van-ellipsis {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.van-nav-bar__title {
    max-width: 60%;
    margin: 0 auto;
    color: #323233;
    font-weight: 500;
    font-size: 16px;
}
.van-nav-bar__text {
    color: #1989fa;
}
.van-icon-arrow-left:before {
    /* content: '\e668'; */
}

.van-icon:before {
    display: inline-block;
}
.van-icon {
    position: relative;
    display: inline-block;
    font: normal normal normal 14px/1 vant-icon;
    text-rendering: auto;
    -webkit-font-smoothing: antialiased;
}
.van-nav-bar__arrow {
    margin-right: 4px;
    font-size: 16px;
}
.van-nav-bar__left{
        position: absolute;
    top: 0;
    bottom: 0;
    display: flex;
    -webkit-box-align: center;
    align-items: center;
    padding: 0 16px;
    font-size: 14px;
    cursor: pointer;
}
.van-nav-bar__content {
    position: relative;
    display: flex;
    -webkit-box-align: center;
    align-items: center;
    height: 46px;
}
.van-nav-bar {
    position: relative;
    z-index: 1;
    line-height: 22px;
    text-align: center;
    background-color: #fff;
    user-select: none;
}
</style>
